/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package assignment2.pkg1;

import java.util.ArrayList;

/**
 *
 * @author MBoon
 */
public class FES {

    private ArrayList<Event> events;
    
    public FES() {
        this.events = new ArrayList<Event>();
    }
    
    /**
     * Remove the first event from this list, and return this event.
     * @return the first event from this list.//
     */
    
    public Event nextEvent() {
        return events.remove(0);
    }
    
    public void add(Event e) {
      int idx = events.size();
      while (idx > 0 ) {
          if (events.get(idx-1).getTime() <= e.getTime()) {
              break;
          }
          idx--;
      }
      events.add(idx, e);
    }
    
    
    
    
    
    
    
    
}


